package com.zzw.thread.communicate;

/**
 * @author zzw
 * @see
 * @since 2018/3/27
 */
public class JoinTest {

    public static void main(String[] args) throws InterruptedException {

        MyThread threadTest = new MyThread();
        threadTest.start();

        //Thread.sleep(?);//因为不知道子线程要花的时间这里不知道填多少时间
        threadTest.join(2000);
        System.out.println("我想当threadTest对象执行完毕后我再执行");
    }

    static public class MyThread extends Thread {

        @Override
        public void run() {
            System.out.println("我想先执行");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
